﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sauces.Bussinees.Entities.Caja;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sauces.Repository.Mapping
{
   public  class DetalleBoletaMap:EntityTypeConfiguration<DetalleBoleta>
    {
       public DetalleBoletaMap()
       {
           this.HasKey(p => new { p.IdBoleta, p.item });

           this.Property(t => t.item)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

           this.Property(t => t.IdBoleta)
               .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

           this.Ignore(p => p.Monto);
           

           this.ToTable("DetalleBoleta");


           this.HasRequired(d => d.Producto).WithMany(d=>d.DetalleBoleta).HasForeignKey(d => d.IdProducto);
           this.HasRequired(d => d.Boleta).WithMany(d => d.DetalleBoleta).HasForeignKey(d => d.IdBoleta);

       }
       
    }
}
